package com.app.qtjk.lsh.service;
import com.app.common.utils.MD5Util;
import com.app.common.utils.ReqJsonUtil;
import com.css.sword.kernel.base.annotation.Service;
import com.css.sword.kernel.base.annotation.ServiceContainer;
import com.css.sword.kernel.utils.SwordLogUtils;
import com.css.sword.platform.web.event.IReqData;
import com.css.sword.platform.web.event.IResData;
import com.css.sword.platform.web.event.SwordRes;

@ServiceContainer
public class FilterService {

	private static SwordLogUtils log = SwordLogUtils.getLogger(FilterService.class);

	public FilterService() throws Exception {
		super();
	}


	/**
	 * 检验客户端与服务器端的token是否一样
	 */
	@Service(serviceName = "FilterService_validateToken")
	public IResData validateToken(IReqData req) throws Exception {

		log.debug("开始进入 FilterService_validateToken 方法。");

		IResData res = new SwordRes();
		// 获取前台post的数据
		String useremail = ReqJsonUtil.getPostParam(req,"useremail");
		String lshToken = ReqJsonUtil.getPostParam(req,"lshToken");
		// 使用用户邮箱和指定串进行md5加密
		String lshTokenstr = MD5Util.MD5(useremail + MD5Util.diyStr);
		boolean tokenFlag = true;
		if (!lshTokenstr.equals(lshToken)) {
			tokenFlag = false;
		}
		res.put("tokenFlag", tokenFlag);
		
		return res;
	}
	

}